//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#include "engine.h"

mspace g_grafixMemorySpace;

IDeviceDriver * CDECL CreateGrafix(uint_t uDeviceNo, void *pvParameter)
{
    g_grafixMemorySpace = create_mspace(0, 1);
    if (!g_grafixMemorySpace) return NULL;

    ECode           ec;

    CGfxEngine    * gfxengine = new CGfxEngine;
    if (!gfxengine) {
        kprintf(">>>>>Create grafix not enough memory\n");

        goto Exit;
    }

    ec = gfxengine->constructor();
    if (FAILED(ec)) {
        kprintf("Constructor grafix failed, the ec = 0x%08x\n", ec);

        goto Exit;
    }

    ec = DzRegisterService(L"Grafix", gfxengine, NULL);
    if (FAILED(ec)) {
        kprintf(">>>>>>Register grafix engine failed, the ec = 0x%08x\n", ec);

        goto Exit;
    }

Exit:
    return NULL;
}
